<template>
	<view>
		<view class="listin">
			<u-cell size="30" title="姓名" :value="name"></u-cell>
			<u-cell size="30" title="联系电话" :value="phone"></u-cell>
			<u-cell size="30" title="修改密码" @click="$goBack(2,'/bundle/pages/password/password')"></u-cell>
			<u-button
				customStyle="margin-top: 400rpx;width:400rpx;height:80rpx;color:#000;font-size:28rpx;font-weight: 600;"
				color="#FBCC32" @click="logout">退出登录</u-button>
				
			<!-- 			<u-cell size="30" title="司机签字">
				<view slot="right-icon" class="kan">查看</view>
			</u-cell> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name: "",
				phone: ""
			}
		},
		created() {
			if( uni.getStorageSync('type') === 2 ){
				this.name = uni.getStorageSync('caruser').driverName;
				this.phone = uni.getStorageSync('caruser').driverPhone;
			}else if(uni.getStorageSync('type') === 1 ){
				this.name = uni.getStorageSync('caruser').nickName;
				this.phone = uni.getStorageSync('caruser').account;
			}else{
				uni.redirectTo({
					url: "/pages/login/login",
				})
			}
		},
		methods: {
			logout() {
				uni.showModal({
				    title: '提示',
				    content: '是否确定退出登录',
				    success: function (res) {
				        if (res.confirm) {
				            uni.removeStorageSync('blade-auth');
				            uni.removeStorageSync('type');
				            uni.removeStorageSync("userId");
				            uni.removeStorageSync('caruser');
				            setTimeout(() => {
				            	uni.redirectTo({
				            		url: "/pages/login/login",
				            	})
				            }, 1000)
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});

			
			}
		}
	}
</script>

<style lang="scss" scoped>
	.listin {
		background-color: #fff;
		height: 100vh;
	}
</style>